package com.cxx.purchasecharge.core.model.persistence;

import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import com.cxx.purchasecharge.core.model.BaseModel;

/**
 * 
 */
@Entity
@Table (name = "pc_payment_account")
public class PaymentAccount extends BaseModel
{
    private static final long serialVersionUID = 1L;

    private long id;
    private String name;
    private String number;

    private List <Payment> payments;

    public PaymentAccount ()
    {
    }

    public PaymentAccount (String name)
    {
        this.name = name;
    }

    @Id
    @GeneratedValue (strategy = GenerationType.AUTO)
    public long getId ()
    {
        return id;
    }

    public void setId (long id)
    {
        this.id = id;
    }

    @Column (nullable = false, unique = true)
    public String getName ()
    {
        return name;
    }

    public void setName (String name)
    {
        this.name = name;
    }

    @Column (nullable = false, unique = true)
    public String getNumber ()
    {
        return number;
    }

    public void setNumber (String number)
    {
        this.number = number;
    }

    @OneToMany (mappedBy = "paymentAccount", cascade =
    { CascadeType.ALL })
    public List <Payment> getPayments ()
    {
        return payments;
    }

    public void setPayments (List <Payment> payments)
    {
        this.payments = payments;
    }

}
